package com.ocm.core.mapping.impl;

import org.springframework.stereotype.Service;

import com.ocm.core.constant.OCMConstant;
import com.ocm.core.mapping.IDMapping;
import com.ocm.core.mapping.MappingConfigureDataSource;


@Service("mappingConfigureDataSource")
public class MappingConfigureDataSourceImpl implements MappingConfigureDataSource {

   public ClassMapping getClassDomainInstance(IDMapping mapping) {
      ClassMapping classMapping = new ClassMapping(new String[] {}, new String[] {});

      if (mapping == null)
         return classMapping;

      switch (mapping) {
      case PROPERTYDEF_DEFAULT:
      case PROPERTYDEF_DEEP:
      case STORAGE_DEFAULT:
      case STORAGE_DEEP:
      case CLASSDEF_DEEP:
      case CLASSDEF_DEFAULT:
         classMapping.setExcludedProperties(new String[] {});
         break;
      case STORAGE_LIMIT:
         classMapping.setExcludedProperties(new String[] {});
         break;
      case CLASSDEF_LIMIT:
         classMapping.setExcludedProperties(new String[] {"propertyDefs"});
         break;
      case INST_PROPERTY_EXCLUDED_CONTENTS:
         classMapping.setExcludedProperties(new String[] {OCMConstant.CONTENT_DATA, OCMConstant.CONTENT_LENGTH, OCMConstant.CONTENT_TYPE, OCMConstant.FILE_NAME});
         break;
      case INST_PROPERTY_EXCLUDED_DATA:
         classMapping.setExcludedProperties(new String[] {OCMConstant.CONTENT_DATA});
         break;
      default:
         break;
      }
      return classMapping;
   }
}
